<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>企业用户注册</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Hosting Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <link href="${pageContext.request.contextPath}/static/home/css/bootstrap.css" rel='stylesheet' type='text/css' />
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="${pageContext.request.contextPath}/static/home/js/jquery-1.11.1.min.js"></script>
    <!-- Custom Theme files -->
    <link href="${pageContext.request.contextPath}/static/home/css/style.css" rel='stylesheet' type='text/css' />
    <!-- Custom Theme files -->
    <!-- webfonts -->
    <link href='${pageContext.request.contextPath}/static/home/css/font-awesome.css' rel='stylesheet' type='text/css'>
    <!-- webfonts -->
    <!-- dropdown -->
    <script src="${pageContext.request.contextPath}/static/home/js/jquery.easydropdown.js"></script>
    <script src="${pageContext.request.contextPath}/static/home/js/jquery-labelauty.js"></script>
    <link href="${pageContext.request.contextPath}/static/home/css/nav.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="${pageContext.request.contextPath}/static/home/css/jquery-labelauty.css" rel='stylesheet' type='text/css' />
    <link href="${pageContext.request.contextPath}/static/admin/css/sweetalert.css" rel="stylesheet">
    <!-- start-smoth-scrolling -->
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/move-top.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/easing.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/home/js/bootstrapValidator.min.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $(".scroll").click(function(event){
                event.preventDefault();
                $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
            });
        });
    </script>
    <style>
        ul.a { list-style-type: none;}
        li.a { display: inline-block;}
        li.a { margin: 10px 0;}
        input.labelauty + label { font: 12px "Microsoft Yahei";}
        .fadeInLeft .labelauty-checked{
            color: #FFFFFF;
        }
        small{
            position: relative;
            top: -32px;
            left:97%;
        }
        .contact small{
            top: -98px;
        }
    </style>
    <!-- end-smoth-scrolling -->
</head>
<!-- Header Starts Here -->
<div class="banner inner-banner" >
    <%@include file="../header.jsp"%>
    <!-- page heading -->
    <div id="breadcrumb_wrapper">
        <div class="container">

            <h3><strong>企业用户注册</strong></h3>
            <h6>&nbsp;</h6>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
<div class="clearfix"> </div>
<!-- Header Ends Here -->
<div class="register-content">
    <div class="container">
        <div class="register">
            <form class="form-company" action="${pageContext.request.contextPath}/register/com_submit.action" method="post">
                <div class="register-top-grid">
                    <h3><strong>企业信息</strong></h3>
                    <div class="wow fadeInLeft  form-group" data-wow-delay="0.4s">
                        <span>企业名称<label>*</label></span>
                        <input type="text" name="company_name">
                    </div>
                    <div class="wow fadeInLeft" data-wow-delay="0.4s">
                        <span>所在地<label>*</label></span>
                        <table>
                            <tr>
                                <td>
									 <span class="input-group-btn">
                         <select class="btn btn-default" id="zone_select" onchange="changeZone()">
                             <c:forEach items="${zone_list}" var="zone">
                                 <c:choose>
                                     <c:when test="${zone.name == '广东省'}">
                                         <option value="${zone.zone_id}" selected>${zone.name}</option>
                                     </c:when>
                                     <c:otherwise>
                                         <option value="${zone.zone_id}">${zone.name}</option>
                                     </c:otherwise>
                                 </c:choose>
                             </c:forEach>
                         </select>
                         </span>
                                </td>

                                <td>
									 <span class="input-group-btn" style="margin-left: 10px">
                         <select class="btn btn-default" id="city_select" name="city_id">

                         </select>
                         </span>
                                </td>
                            </tr>
                        </table>

                    </div>
                    <div class="wow fadeInLeft  form-group contact" data-wow-delay="0.4s">
                        <span>联系人<label>*</label></span>
                        <input type="text" name="contact">
                        <ul class="a">
                            <li class="a"><input type="radio" name="contact_sex" value="M" data-labelauty="男" checked></li>
                            <li class="a"><input type="radio" name="contact_sex" value="F" data-labelauty="女"></li>
                        </ul>

                    </div>
                    <div class="wow fadeInRight form-group" data-wow-delay="0.4s">
                        <span>联系电话<label>*</label></span>

                        <input type="text" placeholder="区号" style="float: left;width: 11%" name="zone_num" onkeydown="if(event.keyCode==13)event.keyCode=9" onkeypress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false" maxlength="4">
                        <span style="float: left;margin-top: 1%; color: grey">—</span>
                        <input type="text" placeholder="固话" style="width: 82%" name="phone" onkeydown="if(event.keyCode==13)event.keyCode=9" onkeypress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false" maxlength="10" >



                    </div>
                    <div class="wow fadeInRight form-group" data-wow-delay="0.4s">
                        <input type="text" placeholder="手机号码" style="margin-top: 5px" name="telephone" onkeydown="if(event.keyCode==13)event.keyCode=9" onkeypress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false" maxlength="11" >
                    </div>
                </div>
                <div class="register-bottom-grid">
                    <h3><strong>账号信息</strong></h3>
                    <div class="wow fadeInLeft form-group" data-wow-delay="0.4s">
                        <span>用户名<label>*</label></span>
                        <input type="text" name="fullname" id="fullname"  onkeyup="this.value=this.value.replace(/[^\w_]/g,'');">
                    </div>
                    <div class="wow fadeInRight form-group" data-wow-delay="0.4s">
                        <span>电子邮箱<label>*</label></span>
                        <input type="text" name="e_mail" id="e_mail">
                    </div>
                    <div class="wow fadeInRight form-group" data-wow-delay="0.4s">
                        <span>密码<label>*</label></span>
                        <input type="password" name="password" id="password">
                    </div>
                    <div class="wow fadeInRight form-group" data-wow-delay="0.4s">
                        <span>确认密码<label>*</label></span>
                        <input type="password" name="confirm_password" id="confirm_password">
                    </div>
                </div>
                <div class="register-but">
                    <input type="submit" value="注册">
                </div>
            </form>

        </div>
    </div>
</div>

<!-- #Testimonials -->
<!-- /#Testimonials -->
<!-- #Footer -->
<%@include file="../footer.jsp"%>
<!-- /#Footer -->
<!-- here stars scrolling icon -->
<script type="text/javascript">
    $(document).ready(function() {
        /*
         var defaults = {
         containerID: 'toTop', // fading element id
         containerHoverID: 'toTopHover', // fading element hover id
         scrollSpeed: 1200,
         easingType: 'linear'
         };
         */

        $().UItoTop({ easingType: 'easeOutQuart' });

    });
</script>
<script src="${pageContext.request.contextPath}/static/admin/js/sweetalert.min.js"></script>
<script>
    <c:if test="${error == 1}">
    alter("服务器出错！");
    </c:if>
    <c:if test="${success == 1}">
    swal({
        title: "",
        text: "注册成功！",
        type: "success",
        showCancelButton: false,
        closeOnConfirm: true,
        confirmButtonText: "确定"
    }, function() {
        window.location.href="${pageContext.request.contextPath}/";
    });
    setTimeout(function(){
        window.location.href="${pageContext.request.contextPath}/";
    },3000);
    </c:if>
    $(function(){
        $(':input').labelauty();
        $('.form-group').data('bootstrapValidator', null);
        $('.fadeInRight').each(function (e) {
            if($(this).hasClass('has-success')){
                $(this).removeClass('has-success');
            }
            if($(this).hasClass('has-error')){
                $(this).removeClass('has-error');
            }
        });
        $('.form-company').bootstrapValidator({
            message: 'This value is not valid',
            fields: {
                company_name:{
                    validators: {
                        notEmpty: {
                            message: '请填企业名称'
                        }
                    }
                },
                contact:{
                    validators: {
                        notEmpty: {
                            message: '请填联系人'
                        }
                    }
                },
                zone_num:{
                    validators: {
                        notEmpty: {
                            message: '请填区号'
                        },
                        numeric: {message: '请输入正确的区号'}
                    }
                },
                phone:{
                    validators: {
                        notEmpty: {
                            message: '请填联系电话'
                        },
                        numeric: {message: '请输入正确电话号码'}
                    }
                },
                telephone:{
                    validators: {
                        notEmpty: {
                            message: '请填手机号码'
                        },
                        numeric: {message: '请输入正确手机号码'},
                        stringLength: {
                            min: 11,
                            max: 11,
                            message: '请输入11位手机号码'
                        },
                    }
                },
                fullname:{
                    validators: {
                        notEmpty: {
                            message: '请填用户名'
                        },
                        stringLength: {
                            min: 3,
                            max: 30,
                            message: '合法长度为3~30'
                        },
                        regexp: {           //正则校验
                            regexp: /^[a-zA-Z0-9_\.]+$/,
                            message: '请输入合法用户名'
                        }
                    }
                },
                e_mail:{
                    validators: {
                        notEmpty: {
                            message: '请填邮箱'
                        },
                        emailAddress: {     //　　邮箱格式校验
                            message: '请填正确邮箱地址'
                        },
                        remote:{
                            message:"该邮箱已被注册！",
                            url:'${pageContext.request.contextPath}/checkExist.action',
                        }
                    }
                },
                password: {
                    message: 'The username is not valid',
                    validators: {
                        notEmpty: {
                            message: '请填写旧密码'
                        },
                        stringLength: {
                            min: 6,
                            max: 30,
                            message: '建议密码为6位以上字符（字母、数字、符号)组合而成'
                        }
                    }
                },
                confirm_password: {
                    message: 'The username is not valid',
                    validators: {
                        notEmpty: {
                            message: '请填写密码'
                        },
                        identical:{
                            field:'password',
                            message:'两次密码输入不一致'
                        }
                    }
                }
            }
        });
    });

    changeZone();

    function changeZone(){
        var zone_id = $('#zone_select').val();
        $.ajax({
            type:'post',
            url:'${pageContext.request.contextPath}/getCityList.action',
            data:'zone_id='+zone_id,
            success:function(data){
                var string="";
                for(var i in data){
                    string +='<option value="'+data[i].city_id+'">'+data[i].name+'</option>';
                }
                $('#city_select').html(string);
            }

        });
    }

</script>
<!-- //here ends scrolling icon -->
</body>
</html>